'use strict';

const Service = require('egg').Service;

const { ME_CATCE_KEY } = require('../../config/redisKey');

class HomelinksService extends Service {
  async detail() {
    return this.ctx.getCache(ME_CATCE_KEY, async () => {
      return await this.ctx.model.Me.findOne()
    })
  }

  async update() {
    await this.ctx.clearCache(ME_CATCE_KEY)
    return await this.ctx.model.Me.updateModel(this.ctx.params.id, this.ctx.w_body());
  }
}

module.exports = HomelinksService;
